#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project  : ecshop
# @File     : backend_share_luckymoney.py
# @Author   : WanLiWei
# @Time     : 2021/7/3 1:25
from time import sleep

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()

driver.get("http://192.168.4.138/ecshop/admin/privilege.php?act=login")
driver.find_element(By.NAME, "username").send_keys("admin")
driver.find_element(By.NAME, "password").send_keys("wlw12345678")
driver.find_element(By.CLASS_NAME, "button").click()

# 进入id为menu-frame的frame
driver.switch_to.frame('menu-frame')
# 点击促销管理
driver.find_element_by_xpath('//ul[@id="menu-ul"]/li[2]').click()
# 点击红包类型
driver.find_element_by_xpath('//ul[@id="menu-ul"]/li[2]/ul/li[2]/a').click()
# 退出frame
driver.switch_to.default_content()

# 进入id为main-frame的frame
driver.switch_to.frame('main-frame')
# 点击发放按钮
driver.find_element_by_xpath('//div[@id="listDiv"]/table/tbody/tr[2]/td[7]/a[1]').click()

# 退出frame
driver.switch_to.default_content()

# 进入id为menu-frame的frame
sleep(2)
driver.switch_to.frame('main-frame')
driver.find_element_by_xpath('/html/body/div[2]/form/table/tbody/tr[3]/td/input').click()

# 断言

# 退出frame
driver.switch_to.default_content()

